package com.el.event;

import java.util.Map;

import com.el.logger.EventLogDispatcher;
import com.el.logger.Action;


public class Event {

    private String id;
    private EventLogDispatcher logDispatcher;
    
    Event(String eventId, EventLogDispatcher logDispatcher) {
        this.id = eventId;
        this.logDispatcher = logDispatcher;
    }

    public String getId() {
        return this.id;
    }
    
    public void logStart() {
        logStart(null);
    }
    
    public void logStart(Map<String, String> params) {
        logDispatcher.log(id, Action.START, params, null);
    }
    
    public void logEnd() {
        logDispatcher.log(id, Action.END, null, null);
    }
    
    public void logException(Throwable t) {
        logDispatcher.log(id, Action.EXCEPTION, null, t);
    }
}
